# _*_coding:utf-8 _*_
# @Time　　:2021/3/14 10:56
# @Author　 : wangyong
# @File　　  :pytest_01.py
# @Software  :PyCharm
import pytest


def add(a, b):
    return a + b


def sub(a, b):
    if a >= b:
        return True
    else:
        return False


def test_a_b():
    assert sub(4, 2)


@pytest.mark.smoke
def test_add_1():
    assert add(1, 2) == 3


def test_add_2():
    assert add('wang', ' yong') == 'wang yong'


class TestAdd:
    @pytest.mark.smoke
    def test_add_01(self):
        assert add(2, 3) == 5

    # @pytest.mark.skip(reason="浮点数相加存在问题")
    def test_add_02(self):
        assert add(10.1, 20.2) == 30.3

    def test_add_03(self):
        assert add('king', ' 158') == 'king 158'


@pytest.mark.parametrize('a', [1, 2, 3])
def test_parametrize(a):
    assert a > 2


@pytest.mark.skip(reason="跳过")
@pytest.mark.parametrize('a,b', [(1, 2), (2, 4)])
def test_parametrize(a, b):
    assert a < b


@pytest.mark.parametrize('a', [1, 2, 3])
@pytest.mark.parametrize('b', [1, 3, 5])
def test_parametrize1(a, b):
    assert a < b


def test_chu0(data):
    assert 'py' in data
    raise NameError

